package yawning.mew.equipment;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

public class RawItem {
	public String name;
	public int id;
	public String icon;
	public Map<Property,Number> properties = new HashMap<Property,Number>();

	public enum Property {
		SLOT,
		ARMOR,
		QUALITY,
		CLASS,
		SUBCLASS,
		ITEM_SET,
		ITEM_LEVEL,

		STAMINA,
		AGILITY,
		STRENGTH,
		INTELLECT,
		SPIRIT,

		SPELL_POWER,
		ATTACK_POWER,
		HASTE_RATING,
		CRIT_RATING,
		EXPERTISE_RATING,
		HIT_RATING,
		DODGE_RATING,
		MASTERY_RATING,
		PARRY_RATING,
		RESILIENCE_RATING,
		SPELL_PENETRATION,
		BONUS_ARMOR,

		NUM_SOCKETS,
		SOCKET1,
		SOCKET2,
		SOCKET3,
		SOCKET_BONUS_STAT,
		SOCKET_BONUS_VALUE,

		MELEE_DMG_MIN,
		MELEE_DMG_MAX,
		MELEE_DPS,
		MELEE_SPEED,

		RANGED_DMG_MIN,
		RANGED_DMG_MAX,
		RANGED_DPS,
		RANGED_SPEED,

		PROC_SPELL_ID,
		PROFESSION_ID,
		PROFESSION_SKILL,
	}

	public RawItem() {
		// Default constructor.
	}

	public RawItem(int id, String name) {
		this.id = id;
		this.name = name;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(name).append(" (").append(id).append(") ");
		for (Entry<Property,Number> e : properties.entrySet()) {
			sb.append('[').append(e.getKey()).append('=').append(e.getValue()).append(']');
		}

		return sb.toString();
	}

	@Override
	public int hashCode() {
		return id;
	}

	@Override
	public boolean equals(Object o) {
		if (o instanceof RawItem) return id == o.hashCode();
		else return false;
	}
}
